<template>

  <div>
<!--    <span >{{seconds/60}}minute</span>-->
    <span>{{ $t('cmd.introduction.real_time_log_name') }}</span>
    <svg-icon icon-class="connect" class="text-xl mr-3" />
    <span >{{Math.floor(seconds/60) }}:{{seconds%60}}</span>

<!--    <span >{{seconds}}s</span>-->

  </div>

</template>

<script>

export default {
  name: 'MonitorLog',
  data() {
    return {
      active: 1,
      seconds: 300
    }
  },
  mounted() {

  },
  beforeDestroy() {
    console.log('beforeDestroy')
    clearInterval(this.secondsInterval)
  },
  methods: {
    initSecond() {
      console.log('initsecond 300s')
      this.seconds = 60 * 5
      this.secondsInterval = setInterval(() => {
        if(this.seconds === 5) {
          console.log('提前结束')
          this.$emit('cleanInterval2')
        }
        if (this.seconds === 0) {
          console.log('time out and clean')
          clearInterval(this.secondsInterval)
          this.$emit('cleanInterval')
        } else {
          this.seconds--
        }
      }, 1000)
    },
    deleteInterval() {
      console.log('delete deleteInterval')
      clearInterval(this.secondsInterval)
    }

  }
}
</script>

<style lang="scss" scoped>

</style>
